import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// 完成按需导入
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    // 自动导入
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    //解析组件
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
  server:{
    host:'0.0.0.0',
    port:10086,
    open:true,
    proxy:{
      '/api':{
        target:'http://localhost:8080',
        changeOrigin:true,
        rewrite:path=>path.replace(/^\/api/,'')
      }
    }
  }
})
